package cn.yitun.chat.yitunserverfilecore.service.impl;

import cn.yitun.chat.yituncommonutil.YitunStringUtil;
import cn.yitun.chat.yitunserverfilecore.manage.FileServerConfigManager;
import cn.yitun.chat.yitunserverfilecore.service.FileServerConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Description <br>
 * Date 2019-07-06 14:18:07<br>
 * 
 * @author yitun
 * @since 1.0.0
 */
@Service
public class FileServerConfigServiceImpl implements FileServerConfigService {

	@Resource
	private FileServerConfigManager fileServerConfigManager;

	public String getServerUrl() {
		return fileServerConfigManager.getServerUrl();
	}

	public String getFileUrl(String nodePath) {
		String url = "";
		String path = getServerUrl();
		if (YitunStringUtil.isNotEmpty(path)) {
			url = "/files/" + nodePath;
		}
		return url;
	}
}
